<!DOTPEEK html>
<!-- <%@ page import="java.util.List" %> -->
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <title>login</title>
</head>

<body>
<div style="height: 200px;display: flex;">
    <div style="width: 20%;"></div>
    <div
            style="width: 60%;background-color: aquamarine;font-size: xxx-large;text-align: center;line-height: 200px;color: white">
        文件上传系统
    </div>
    <div style="width: 20%;"></div>
</div>
<div style="height: 30px;"></div>
<div style="display:flex ;">
    <div style="width: 30%;"></div>
    <div style="width: 40%;">
        <form action="http://localhost:8080/file/upload" method="post" enctype="multipart/form-data"
              content="charset=UTF-8"
              style="width:601px;background-color: aquamarine;color: white;height: 200px;">
            <div style="height: 15px"></div>
            <div style="text-align: center;font-size: x-large">上传文件</div>
            <div style="height: 32px"></div>
            <div style="display:flex">
                <div style="width:30% ;"></div>
                <input id="input" name="file" type="file" class="file" multiple data-show-upload="false"
                       data-show-caption="true" data-msg-placeholder="Select {files} for upload...">
                <div style="width:20% ;"></div>
            </div>
            <div style="height: 25px"></div>
            <div style="display: flex">
                <div style="width: 44.5%"></div>
                <div style="width: 55.5%"><input
                        style="font-size: x-large;background-color:aquamarine;color: white;border-color: white;border-width: medium;"
                        type="submit" value="提交">
                </div>
            </div>
        </form>
        <div style="background-color:aquamarine;text-align: center;color:white;">
            <h2 class="sub-header">上传文件列表</h2>
        </div>
        <div style="background-color: aquamarine; text-align:center;color: white;align-content: center;">
            <table style="width: 100%;">
                <thead style="text-align: center;color:white;align-items:center;">
                <tr>
                    <th>#</th>
                    <th>文件名</th>
                    <th>文件类型</th>
                </tr>
                </thead>
                <tbody style="text-align: center;color:white">

                <% List<String> files = (List<String>) request.getAttribute("Files");
                %>
                <% if(files !=null){ for(Integer i=0; i< files.size(); i++){ String
                        file=files.get(i); String[] parts=file.split("\\."); String
                        fType=parts[parts.length - 1]; %>
                <div style="width: 100px;">
                    <tr>
                        <td>
                            <%=i%>
                        </td>
                        <td>
                            <%=file%>
                        </td>
                        <td>
                            <%=fType%>
                        </td>
                    </tr>
                </div>
                <% } } %>
                </tbody>
            </table>
        </div>
    </div>
    <div style="width: 30%;"></div>
</div>
</body>

</html>